import request from "@/utils/request";

const path = '/employee'

// 新增员工
export const addEmployee = (data) => {
    return request({
        url: path,
        method: 'post',
        data
    })
}

// 员工分页查询
export const getEmployeePage = (params) => {
    return request({
        url: path + '/page',
        params
    })
}

// 修改员工头像
export const updateEmployeeAvatar = (data) => {
    return request({
        url: path + '/updateAvatar',
        method: 'post',
        data
    })
}

// 修改员工信息
export const updateEmployee = (data) => {
    return request({
        url: path,
        method: 'put',
        data
    })
}

// 修改员工密码
export const updateEmployeePassword = (data) => {
    return request({
        url: path + '/password',
        method: 'put',
        data
    })
}

// 根据id查询员工
export const queryEmployeeById = (id) =>
    request({
        url: path + `/${id}`,
        'method': 'get'
    })

// 启用禁用员工账号
export const enableOrDisableEmployee = (data) =>
    request({
        url:  path + `/status/${data.status}`,
        'method': 'post',
        params: { id: data.id }
    })
